<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SHOP 管理中心 - 权限管理 </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/admin/styles/general.css" rel="stylesheet" type="text/css" />
<link href="/admin/styles/main.css" rel="stylesheet" type="text/css" />
</head>
<body>

<h1>
<span class="action-span">权限管理</span>
<span class="action-span1">SHOP 管理中心</span><span id="search_id" class="action-span1"> - 添加权限 </span>
<div style="clear:both"></div>
</h1>

<div class="main-div">
<form method="post" action="node_edit" name="theForm" enctype="multipart/form-data" onsubmit="return validate()">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<table cellspacing="1" cellpadding="3" width="100%">
  <tbody><tr>
    <td class="label">权限名称</td>
    <td><input type="text" name="node_name" maxlength="60" value="{{$listOne->node_name}}"><span class="require-field">*</span></td>
  </tr>
  <tr>
    <td class="label">权限标题</td>
    <td><input type="text" name="node_title" maxlength="60" size="40" value="{{$listOne->node_title}}"></td>
  </tr>
	<tr>
	      <td class="label">等级</td>
	      <td>
	        <select name="level" id='lev'>
	        @if($listOne->level==1)
	            <option value="1" selected="selected">控制器</option>
	            <option value="2">方法</option>  
     		@else
                <option value="1">控制器</option>
                <option value="2" selected="selected">方法</option>  
            @endif  
	        </select>
        
	      </td>
	</tr>

	<tr>
	      <td class="label">父级</td>
	      <td>
	        <select name="pid" id='pid' class="pid">
				@foreach ($fulist as $v) 
					
				<option value="{{$v->node_id}}"
					@if($v->node_id==$listOne->node_id)
					selected
					 @endif 
				>{{$v->node_title}}</option>

				@endforeach
	        </select>    
	      </td>
	</tr>

  <tr>
    <td class="label">是否启用</td>
    <td>
        @if($listOne->status==1)
            <input type="radio" name="status" value="1" checked="checked">是
             <input type="radio" name="status" value="0">否  
 		@else
		      <input type="radio" name="status" value="1" >是
		       <input type="radio" name="status" value="0" checked="checked">否  
        @endif  
  
    </td>
  </tr>

  <tr>
    <td class="label">是否在左侧显示</td>
    <td>
        @if($listOne->display==1)
            <input type="radio" name="display" value="1" checked="checked">是
             <input type="radio" name="display" value="0">否  
 		@else
		      <input type="radio" name="display" value="1" >是
		       <input type="radio" name="display" value="0" checked="checked">否  
        @endif   
    </td>
  </tr>

  <tr>
    <td colspan="2" align="center"><br>
      <input type="submit" class="button" value=" 确定 ">
      <input type="reset" class="button" value=" 重置 ">
      <input type="hidden" name="node_id" value="{{$listOne->node_id}}"/>
      <input type="hidden" name="act" value="insert">
      <input type="hidden" name="old_brandname" value="">
      <input type="hidden" name="id" value="">
      <input type="hidden" name="old_brandlogo" value="">
    </td>
  </tr>
</tbody></table>
</form>
</div>

</body>
</html>
<script src="/admin/js/jquery.js"></script>
<script>
		  $('#lev').on('change',function(){
	      var level = $(this).val();
	      if(level ==1){
	        $('.pid').html("<option value='0'>请选择...</option>");
	        return;
	      }
	      $.ajax({
	        url:"getlist/"+level,
	        type:'get',
	        dataType:'json',
	        success:function(msg){
	            var str = '';
	            for(var i=0;i<msg.length;i++){
	                str+="<option value='"+msg[i].node_id+"'>"+msg[i].node_title+"</option>";
	            }
	            $('#pid').html(str);
	           
	        }
	      })
	  })

</script>